package metier;

import java.util.ArrayList;
import java.util.List;

import services.persistance.BaseDAO;

import modele.Administrateur;
import modele.Emplacement;
import modele.Province;
import modele.Region;
import dao.AdministrateurDao;
import dao.ProvinceDao;
import dao.RegionDao;

public class ProvinceMetier {
	
	
	public static List<Province> getListeProvinces(long idAdmin) {
		return ProvinceDao.getListeProvinces(idAdmin);
	}

	public static boolean ajouterProvince(Province province) {

		ProvinceDao.ajouterProvince(province);
		return true;

	}
	public static Province getProvince(long identifiant) {
		return ProvinceDao.getProvince(identifiant);
	}
	public static void supprimerProvince(long idProvince) {
		Province province = ProvinceDao.getProvince(idProvince);
		ProvinceDao.supprimerProvince(province);
	}
	public static List<Province> getProvincesRegion(long idRegion) {
		return ProvinceDao.getProvincesRegion(idRegion);
	}
	public static boolean modifierProvince(Province province) {

		Province pro = ProvinceDao.getProvince(province.getIdentifiant());
		pro.setNom(province.getNom());
		pro.setDescription(province.getDescription());
		pro.setPopulation(province.getPopulation());
		pro.setRegion(province.getRegion());

		ProvinceDao.modifierProvince(pro);
		return true;

	}
	
	public static ArrayList<Province> rechercherProvinces(Province province) {
		return ProvinceDao.rechercherProvincesParCriteresParAdmin(province);
	}


	public static Administrateur getAdministrateur(long idAdministrateur) {
		return AdministrateurDao.getAdministrateur(idAdministrateur);
	}
}
